home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / unclcarl / gfahelp1 / error.lst < prev    next >
File List  |  1995-04-25  |  1KB  |  32 lines

  1. ' This is an example of an Error Handling routine which can be used to help
  2. ' keep your programs from crashing from a simple oversight.
  3. ' This example will try to write to a disk, so you may wish to place a
  4. ' BLANK formatted floppy in drive A. Make sure that the WRITE-PROTECT notch
  5. ' is OPEN (so that you CANNOT write to it).
  6. '
  7. '
  8. ALERT 1,"|Are you ready to write |to disk A:\*.* ..? ",1," Yes | No ",a
  9. IF a=1
  10.   GOTO written
  11. ELSE
  12.   EDIT
  13. ENDIF
  14. '
  15. written:
  16. ON ERROR GOSUB oops            !If there's an error go to PROCEDURE oops
  17. test$="A:\TEST.TXT"            !The name of the file & where it is
  18. DEFMOUSE 2                     !cursor is bee shape
  19. OPEN "O",#1,test$              !Open file
  20. PRINT #1,"This is a test..."   !write to it
  21. CLOSE #1                       !close it
  22. '
  23. help_me:
  24. DEFMOUSE 0                     !cursor is arrow shaped
  25. ALERT 1,"|We'll be quitting now... ",1," Aww ",a
  26. EDIT
  27. '
  28. PROCEDURE oops
  29.   ~FORM_ALERT(1,ERR$(ERR))  !Prints appropriate ERROR message (*Write Protected)
  30.   RESUME help_me            !Resume program AFTER the point in which the error
  31. RETURN                      !was encountered.
  32.